#include "RSManager.h"
#include "ShareComponents.h"
#include "FWContentManager.h"
#include "FWSound.h"
#include "FWSurface.h"
#include "FWTexture.h"
#include "Sprite.h"
RSManager::RSManager(void)
{
}


RSManager::~RSManager(void)
{
}

void RSManager::Init()
{	
#pragma region LOAD_IS_RESOURCES			
	this->is_go_left = new Sprite(gl_content->loadTexture("Resources\\IS\\is_left.png"),35,35,5,5,70,70);	
	this->is_go_right = new Sprite(gl_content->loadTexture("Resources\\IS\\is_right.png"),35,35,5,5,70,70);	
	this->is_jump_left = new Sprite(gl_content->loadTexture("Resources\\IS\\jump_left.png"),35,35,1,1,70,70);	
	this->is_jump_right = new Sprite(gl_content->loadTexture("Resources\\IS\\jump_right.png"),35,35,1,1,70,70);	
	this->is_sink = new Sprite(gl_content->loadTexture("Resources\\IS\\sink.png"),17,8,1,1,34,16);
#pragma endregion

#pragma region LOAD_PLAYER_RESOURCES
	player_go_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\GO\\right.png"),25,37,6,6,50,74);	
	player_go_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\GO\\left.png"),25,37,6,6,50,74);	

	player_I = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\GO\\I.png"),25,35,3,3,50,70);	
	player_II = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\GO\\II.png"),25,35,3,3,50,70);	
	player_III= new Sprite(gl_content->loadTexture("Resources\\PLAYER\\GO\\III.png"),25,35,3,3,50,70);	
	player_IV= new Sprite(gl_content->loadTexture("Resources\\PLAYER\\GO\\IV.png"),25,35,3,3,50,70);	

	player_jump_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\JUMP\\right.png"),20,20,4,4,40,40);	
	player_jump_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\JUMP\\left.png"),20,20,4,4,40,40);	

	player_jump_down_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\JUMP\\lFall.png"), 21, 34, 1, 1, 42, 74);
	player_jump_down_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\JUMP\\rFall.png"), 21, 34, 1, 1, 42, 74);

	player_shoot_right= new Sprite(gl_content->loadTexture("Resources\\PLAYER\\STAND\\shoot_right.png"),25,37,1,1,50,74);
	player_shoot_left= new Sprite(gl_content->loadTexture("Resources\\PLAYER\\STAND\\shoot_left.png"),25,37,1,1,50,74);
	player_stand_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\STAND\\stand_right.png"),25,37,1,1,50,74);
	player_stand_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\STAND\\stand_left.png"),25,37,1,1,50,74);

	player_shoot_top_left= new Sprite(gl_content->loadTexture("Resources\\PLAYER\\STAND\\shoot_top_left.png"),25,46,1,1,50,92);
	player_shoot_top_right= new Sprite(gl_content->loadTexture("Resources\\PLAYER\\STAND\\shoot_top_right.png"),14,46,1,1,37,92);
	player_stand_top_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\STAND\\top_right.png"),14,46,1,1,37,92);
	player_stand_top_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\STAND\\top_left.png"),25,46,1,1,50,92);

	player_gs_right= new Sprite(gl_content->loadTexture("Resources\\PLAYER\\GO\\go_shoot_right.png"),25,37,3,3,50,74);
	player_gs_left= new Sprite(gl_content->loadTexture("Resources\\PLAYER\\GO\\go_shoot_left.png"),25,37,3,3,50,74);

	player_lie_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\LIEDOWN\\lie_left.png"),35,17,1,1,70,34);
	player_lie_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\LIEDOWN\\lie_right.png"),35,17,1,1,70,34);
	player_lie_shoot_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\LIEDOWN\\lie_shoot_left.png"),35,17,1,1,70,34);
	player_lie_shoot_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\LIEDOWN\\lie_shoot_right.png"),35,17,1,1,70,34);

	player_swim_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\SWIM\\left.png"), 15, 17, 1, 1, 48, 34);
	player_swim_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\SWIM\\right.png"), 15, 17, 1, 1, 48, 34);

	player_swim_shoot_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\SWIM\\ss_left.png"), 24, 17, 1, 1, 48, 34);
	player_swim_shoot_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\SWIM\\ss_right.png"), 24, 17, 1, 1, 48, 34);

	player_ss_I = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\SWIM\\I.png"), 19, 20, 1, 1, 38, 40);
	player_ss_II = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\SWIM\\II.png"), 19, 20, 1, 1, 38, 40);

	player_ss_top_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\SWIM\\shoot_top_left.png"), 15, 30, 1, 1, 30, 60);
	player_ss_top_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\SWIM\\shoot_top_right.png"), 15, 30, 1, 1, 30, 60);

	player_swim_down = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\SWIM\\lie_down.png"), 17, 8, 1, 1, 34, 16);
	
	player_die_left = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\DIE\\left.png"), 35, 35, 5, 5, 70, 70);
	player_die_right = new Sprite(gl_content->loadTexture("Resources\\PLAYER\\DIE\\right.png"), 35, 35, 5, 5, 70, 70);
#pragma endregion

#pragma region BLOCK_HOUSE_RESOURCES
	block_house_angle = new Sprite(gl_content->loadTexture("Resources\\BLOCKHOUSE\\angle.png"), 32, 32, 16, 16, 64, 64);
	block_house_simple = new Sprite(gl_content->loadTexture("Resources\\BLOCKHOUSE\\simple.png"), 32, 32, 3, 3, 64, 64);
	block_house_start = new Sprite(gl_content->loadTexture("Resources\\BLOCKHOUSE\\start.png"), 32, 32, 1,1, 64, 64);

#pragma endregion

#pragma region LOAD_MAP_RESOURCE	
	this->map1 = new Sprite(gl_content->loadTexture("Resources\\MAP\\map1.png"), 32, 32, 115, 115, 32, 32);
	this->map3 = new Sprite(gl_content->loadTexture("Resources\\MAP\\map3.png"), 32, 32, 130, 130, 32, 32);
	this->map5 = new Sprite(gl_content->loadTexture("Resources\\MAP\\map5.png"), 32, 32, 138, 138, 32, 32);
	this->map1_effect = new Sprite(gl_content->loadTexture("Resources\\MAP\\map1_effect.png"), 6656, 480, 1, 1, 6656, 480);
	this->map3_effect1 = new Sprite(gl_content->loadTexture("Resources\\MAP\\map3_effect1.png"), 512, 4352, 1, 1, 512, 4352);
	this->map3_effect2 = new Sprite(gl_content->loadTexture("Resources\\MAP\\map3_effect2.png"), 512, 4352, 1, 1, 512, 4352);
	this->map5_effect = new Sprite(gl_content->loadTexture("Resources\\MAP\\map5_effect1.png"), 10272, 480, 1, 1, 10272, 480);
#pragma endregion

#pragma region LOAD_BULLETS_RESOURCES
	bR = new Sprite(gl_content->loadTexture("Resources\\BULLET\\R.png"), 8, 8, 1, 1, 8, 8);
	bM = new Sprite(gl_content->loadTexture("Resources\\BULLET\\M.png"), 15, 15, 1, 1, 15, 15);
	bE = new Sprite(gl_content->loadTexture("Resources\\BULLET\\E.png"), 6, 6, 1, 1, 6, 6);
	bL = new Sprite(gl_content->loadTexture("Resources\\BULLET\\L.png"), 80, 8, 1, 1, 80, 8);
	grenade = new Sprite(gl_content->loadTexture("Resources\\BULLET\\grenade.png"), 40, 40, 4, 4, 40, 40);
#pragma endregion

#pragma region LOAD_EFFECT_RESOURCES
	damage_brige = new Sprite(gl_content->loadTexture("Resources\\EFFECT\\damage_bridge.png"), 30, 30, 3, 3, 60, 60);	
#pragma endregion
#pragma region GIFT
	flying_gift = new Sprite(gl_content->loadTexture("Resources\\GIFT\\flyinggift.png"), 26, 16, 1, 1, 52, 32);
#pragma endregion
#pragma region SOLDIER
	soldier_left_gun = new Sprite(gl_content->loadTexture("Resources\\SOLDIER\\left_gun.png"), 24, 32, 2, 2, 48, 64);
	soldier_right_gun = new Sprite(gl_content->loadTexture("Resources\\SOLDIER\\right_gun.png"), 24, 32, 2, 2, 48, 64);
	soldier_left_top_gun = new Sprite(gl_content->loadTexture("Resources\\SOLDIER\\left_top_gun.png"), 18, 39, 2, 2, 36, 78);
	soldier_righ_top_gun = new Sprite(gl_content->loadTexture("Resources\\SOLDIER\\right_top_gun.png"), 18, 39, 2, 2, 36, 78);
	soldier_left_bottom_gun = new Sprite(gl_content->loadTexture("Resources\\SOLDIER\\left_bottom_gun.png"), 24, 31, 1, 1, 48, 62);
	soldier_right_bottom_gun = new Sprite(gl_content->loadTexture("Resources\\SOLDIER\\right_bottom_gun.png"), 24, 31, 1, 1, 48, 62);
	soldier2_left = new Sprite(gl_content->loadTexture("Resources\\SOLDIERII\\left.png"),24,21,3,3,48,42);
	soldier2_right = new Sprite(gl_content->loadTexture("Resources\\SOLDIERII\\right.png"),24,21,3,3,48,42);
#pragma endregion

#pragma region EMBUSHGUN
	embushgun_appear = new Sprite(gl_content->loadTexture("Resources\\EMBUSHGUN\\appear.png"), 32, 32, 3, 3, 64, 64);
	embushgun_gun = new Sprite(gl_content->loadTexture("Resources\\EMBUSHGUN\\gun.png"), 32, 32, 3, 3, 64, 64);
#pragma endregion

#pragma region DEFENSE_CANON
	defenseCannon = new Sprite(gl_content->loadTexture("Resources\\DEFENSE_CANON\\canon.png"), 35, 12, 2, 2, 35, 12);
	explodeCannon = new Sprite(gl_content->loadTexture("Resources\\DEFENSE_CANON\\explode.png"), 40, 40, 4, 4, 40, 40);
#pragma endregion

#pragma region SCENE
	memu_background = new Sprite(gl_content->loadTexture("Resources\\MENU\\menu_background.png"), 320, 240, 1, 1,640,480);
	option_icon = new Sprite(gl_content->loadTexture("Resources\\MENU\\option_icon.png"), 16, 10, 1, 1, 34, 20);
#pragma endregion
	platform =new Sprite(gl_content->loadTexture("Resources\\PLATFORM\\Platform.png"),32, 31, 1 , 1, 64, 62);
#pragma region BOSS
	boss = new Sprite(gl_content->loadTexture("Resources\\BOSS\\boss1.png"), 50, 64, 2, 2, 50, 64);
	boss_explode = new Sprite(gl_content->loadTexture("Resources\\BOSS\\explode.png"), 64, 64, 6, 6, 64, 64);
	boss_eff1 = new Sprite(gl_content->loadTexture("Resources\\BOSS\\b1_eff1.png"), 64, 64, 6, 6, 64, 64);
	boss_eff2 = new Sprite(gl_content->loadTexture("Resources\\BOSS\\b1_eff2.png"), 64, 64, 6, 6, 64, 64);
	boss_eff3 = new Sprite(gl_content->loadTexture("Resources\\BOSS\\b1_eff3.png"), 64, 64, 6, 6, 64, 64);
	boss_eff4 = new Sprite(gl_content->loadTexture("Resources\\BOSS\\b1_eff4.png"), 64, 64, 6, 6, 64, 64);
	boss_eff5 = new Sprite(gl_content->loadTexture("Resources\\BOSS\\b1_eff5.png"), 64, 64, 6, 6, 64, 64);
	boss_eff6 = new Sprite(gl_content->loadTexture("Resources\\BOSS\\b1_eff6.png"), 64, 64, 6, 6, 64, 64);
	boss_eff7 = new Sprite(gl_content->loadTexture("Resources\\BOSS\\b1_eff7.png"), 64, 64, 6, 6, 64, 64);
	boss_eff8 = new Sprite(gl_content->loadTexture("Resources\\BOSS\\b1_eff8.png"), 64, 64, 6, 6, 64, 64);
	boss_eff9 = new Sprite(gl_content->loadTexture("Resources\\BOSS\\b1_eff9.png"), 64, 64, 6, 6, 64, 64);
	boss_eff10 = new Sprite(gl_content->loadTexture("Resources\\BOSS\\b1_eff10.png"), 64, 64, 6, 6, 64, 64);
#pragma endregion
}
RSManager* RSManager::getInstance()
{
	if(_instance == NULL)
	{
		_instance = new RSManager();
	}
	return _instance;
}


FWSound* RSManager::getSound(SOUND_ID id)
{
	return NULL;
}

Sprite* RSManager::getSprite(SPRITE_ID id)
{
	switch (id)
	{
#pragma region PLAYER

	case PLAYER_GO_LEFT:
		return player_go_left;
		break;
	case PLAYER_GO_RIGHT:
		return player_go_right;
		break;
	case PLAYER_JUMP_UP_LEFT:
		return player_jump_left;
		break;
	case PLAYER_JUMP_UP_RIGHT:
		return player_jump_right;
		break;
	case PLAYER_FALL_DOWN_LEFT:
		return player_jump_down_left;
		break;
	case PLAYER_FALL_DOWN_RIGHT:
		return player_jump_down_right;
		break;
	case PLAYER_I:
		return player_I;
		break;
	case PLAYER_II:
		return player_II;
		break;
	case PLAYER_III:
		return player_III;
		break;
	case PLAYER_IV:
		return player_IV;
		break;
	case PLAYER_SHOOT_TOP_RIGHT:
		return this->player_shoot_top_right;
	case PLAYER_SHOOT_TOP_LEFT:
		return this->player_shoot_top_left;
	case PLAYER_STAND_TOP_LEFT:
		return this->player_stand_top_left;
	case PLAYER_STAND_TOP_RIGHT:
		return this->player_stand_top_right;
	case  PLAYER_GSHOOT_LEFT: 
		return player_gs_left;
	case  PLAYER_GSHOOT_RIGHT: 
		return player_gs_right;
	case PLAYER_SHOOT_LEFT: 
		return player_shoot_left;
	case PLAYER_SHOOT_RIGHT: 
		return player_shoot_right;
	case PLAYER_STAND_LEFT:
		return player_stand_left;
	case PLAYER_STAND_RIGHT:
		return player_stand_right;
	case PLAYER_LIE_LEFT:
		return player_lie_left;
	case PLAYER_LIE_RIGHT:
		return player_lie_right;
	case PLAYER_LIE_SHOOT_LEFT:
		return player_lie_shoot_left;
	case PLAYER_LIE_SHOOT_RIGHT:
		return player_lie_shoot_right;
	case PLAYER_SWIM_LEFT:
		return player_swim_left;
	case PLAYER_SWIM_RIGHT:
		return player_swim_right;
	case PLAYER_SWIM_I:
		return player_ss_I;
	case PLAYER_SWIM_II:
		return player_ss_II;
	case PLAYER_SWIM_S_TOP_LEFT:
		return player_ss_top_left;
	case PLAYER_SWIM_S_TOP_RIGHT:
		return player_ss_top_right;
	case PLAYER_SWIM_SHOOT_LEFT:
		return player_swim_shoot_left;
	case PLAYER_SWIM_SHOOT_RIGHT:
		return player_swim_shoot_right;
	case PLAYER_SWIM_DOWN:
		return player_swim_down;
	case PLAYER_DIE_LEFT:
		return player_die_left;
	case PLAYER_DIE_RIGHT:
		return player_die_right;
#pragma endregion

#pragma region IS
	case IS_GO_LEFT:
		return is_go_left;
		break;
	case IS_GO_RIGHT:
		return is_go_right;
		break;
	case IS_JUMP_LEFT:
		return is_jump_left;
		break;
	case IS_JUMP_RIGHT:
		return is_jump_right;
		break;	
	case SINK:
		return is_sink;
		break;
#pragma endregion

#pragma region MAP
	case MAP1:
		return map1;
		break;
	case MAP3:
		return map3;
		break;
	case MAP5:
		return map5;
		break;
	case MAP1_EFFECT:
		return new Sprite( map1_effect);
		break;
	case MAP3_EFFECT1:
		return new Sprite( map3_effect1);
		break;
	case MAP3_EFFECT2:
		return new Sprite( map3_effect2);
		break;
	case MAP5_EFFECT:
		return new Sprite( map5_effect);
		break;
#pragma endregion

#pragma region BULLET
	case BM:
		return bM;
	case BR:
		return bR;
	case BE:
		return bE;
	case BL:
		return bL;
	case GRENADE:
		return new Sprite (grenade);
#pragma endregion

#pragma region BLOCK_HOUSE
	case BLOCK_HOUSE_ANGLE:
		return new Sprite(block_house_angle);
	case BLOCK_HOUSE_SIMPLE:
		return new Sprite(block_house_simple);
	case BLOCK_HOUSE_START:
		return new Sprite(block_house_start);
#pragma endregion

#pragma region EFFECT
	case DAMAGE_BRIDGE:
		return new Sprite( damage_brige);	
#pragma endregion

#pragma region GIFT
	case FLYING_GIFT:
		return flying_gift;
#pragma endregion

#pragma region SOLDIER
	case SOLDIER_LEFT_GUN:
		return new Sprite(soldier_left_gun);
	case SOLDIER_RIGHT_GUN:
		return new Sprite(soldier_right_gun);
	case SOLDIER_LEFT_TOP_GUN:
		return new Sprite(soldier_left_top_gun);
	case SOLDIER_RIGH_TOP_GUN:
		return new Sprite(soldier_righ_top_gun);
	case SOLDIER_LEFT_BOTTOM_GUN:
		return new Sprite(soldier_left_bottom_gun);
	case SOLDIER_RIGHT_BOTTOM_GUN:
		return new Sprite(soldier_right_bottom_gun);
	case SOLDIER2_LEFT:
		return new Sprite(soldier2_left);
	case  SOLDIER2_RIGHT:
		return new Sprite(soldier2_right);
#pragma endregion
#pragma region EMBUSHGUN
	case EMBUSHGUN_APPEAR:return new Sprite(embushgun_appear);
	case EMBUSHGUN_GUN: return new Sprite(embushgun_gun);
#pragma endregion

#pragma region DEFENSE_CANON
	case DEFENSE_CANNON:
		return new Sprite(defenseCannon);
	case EXPLODE_CANNON:
		return new Sprite(explodeCannon);
#pragma endregion
#pragma region MENU
	case MENU_BACKGROUND: return memu_background;
	case OPTION_ICON: return option_icon;
#pragma endregion
	case PLATFORM: return new Sprite(platform);
#pragma region BOSS
	case BOSS:
		return boss;
	case BOSS_EXPLODE:
		return boss_explode;
	case BOSS_EFF1:
		return boss_eff1;
	case BOSS_EFF2:
		return boss_eff2;
	case BOSS_EFF3:
		return boss_eff3;
	case BOSS_EFF4:
		return boss_eff4;
	case BOSS_EFF5:
		return boss_eff5;
	case BOSS_EFF6:
		return boss_eff6;
	case BOSS_EFF7:
		return boss_eff7;
	case BOSS_EFF8:
		return boss_eff8;
	case BOSS_EFF9:
		return boss_eff9;
	case BOSS_EFF10:
		return boss_eff10;
#pragma endregion
	}	
}